<script>
		$(document).ready(function(){
		  $(".login_msg").hide();
			/*
			 * Validate the form when it is submitted
			 */
			var validatelogin = $("#login-form").validate({
				invalidHandler: function(form, validator) {
					var errors = validator.numberOfInvalids();
					if (errors) {
                        var message="Hãy nhập tài khoản và mật khẩu ";                    
						$('.box .content').removeAlertBoxes();
						$('.box .content').alertBox(message, {type: 'warning', icon: true, noMargin: false});
						$('.box .content .alert').css({
							width: '',
							margin: '0',
							borderLeft: 'none',
							borderRight: 'none',
							borderRadius: 0
						});
					} else {
						$('.box .content').removeAlertBoxes();
					}
				},
				showErrors : function(errorMap, errorList) {
				},
				submitHandler: function(form) {
					var username=$('.username').val();
                    var pword=$('.password').val();
                    
                    $.ajax({
            			type: "POST",
            			url: "auth/check",
            			data: {uname:username,upword:pword},
            			success: function(response)
            			{
            				if(response == 'success')
            					$("#login-form").slideUp('slow', function() {
            					    $(".login_msg").show('fast');
            						$(".login_msg").html("<p class='success'>Đăng nhập thành công!</p>");
                                    window.location.replace('common');                                    
            					});
            				else
            					{
            					   show_msg("Tên tài khoản hoặc mật khẩu không đúng");
            					}
                            	
            			}
            		});
				}
			});    
		});
        
        function show_msg(msg){
        $('.box .content').removeAlertBoxes();
        $('.box .content').alertBox(msg, {type: 'error', icon: true, noMargin: false});
        $('.box .content .alert').css({
							width: '',
							margin: '0',
							borderLeft: 'none',
							borderRight: 'none',
							borderRadius: 0
		});
        }
        
</script>
        
<div class="top">
			<div class="gradient"></div>
			<div class="white"></div>
			<div class="shadow"></div>
		</div>
		<div class="content">
			<h1>Sobic | Administrator</h1>
			<div class="background"></div>
			<div class="wrapper">
            
				<div class="box">
					<div class="header grey">
						<img src="<?php echo THEME_PATH.$userCurrentTheme?>/img/icons/packs/fugue/16x16/lock.png" width="16" height="16">
						<h3>Login</h3>
					</div>
                    
					<form method="get" action="dashboard.html" id="login-form">
						<div class="content no-padding">
                        
							<div class="section _100">
								<label>
									Username
								</label>
								<div>
									<input name="username" type="text" class="required username"/>
								</div>
							</div>
							<div class="section _100">
								<label>
									Password
								</label>
								<div>
									<input name="password" type="password" class="required password"/>
								</div>
							</div>
						</div>
						<div class="actions">
							<div class="actions-left" style="margin-top: 8px;">
								<label for="newsletter2">
									<input name="autologin" type="checkbox" hidden="hidden"/>
									Auto-login in future.
								</label>
                                
                                    
                            <div class=" grey" style="margin:10px 0px;">
                        <a href="auth/forgot" title="Quên mật khẩu" style="margin-left: 30px;">? Quên mật khẩu</a>
                        <a href="auth/register" title="Đăng ký tài khoản" style="margin-left: 60px;">Đăng ký tài khoản</a>
                    </div>    
							</div>
							<div class="actions-right">
								<input type="submit" value="Login"/>
							</div>
                            
						</div>
					</form>
                    
                    <div class="login_msg content no-padding with-actions grey " style="padding: 0 20px; color:red;">
                    Login message 
                    </div>
                    
				</div>
				<div class="shadow"></div>
                
                
			</div>
		</div>
		
		